package com.openness.spider.api;

import com.openness.generator.IdGenerator;

/**
 * @author Rain
 * @version 2013-8-4 下午5:11:24
 */

public class GeneratorThread extends Thread {

	private IdGenerator generator;

	public GeneratorThread(IdGenerator generator) {
		this.generator = generator;
	}

	@Override
	public void run() {
		int count = 0;

		while (true) {
			System.out.println(Thread.currentThread().getName() + "\t"
					+ generator.get());

			try {
				Thread.sleep(3000);
			} catch (InterruptedException e) {
			}

			count++;

			if (count == 5) {
				break;
			}
		}
	}
}
